package com.qcq.wecheck.auth;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * <p>
 * ak/sk权限验证切面
 * </p>
 *
 * @author O
 * @version 1.0
 * @since 2018/9/16
 */
@Aspect
@Component
@Slf4j
public class AuthAspect {
	/**
	 * 定义一个方法，用于声明切入点表达式，可重用
	 */
	@Pointcut("@annotation(com.qcq.wecheck.auth.Auth)")
	public void expression() {
	}

	@Around(value = "expression()")
	public Object before(ProceedingJoinPoint pjp) throws Throwable {
		System.out.println(pjp.getSignature().getName() + " 标注了注解@Auth ...");
		return pjp.proceed();
	}
}
